﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Microsoft.WindowsServerSolutions.Common.UI.TaskDialog;

namespace TV4Home.Server.Vail.AddIn.TabPageControls
{
    public partial class InstallationTabUserControl : UserControl
    {
        public InstallationTabUserControl()
        {
            InitializeComponent();
        }

        private void btnDeviceMgr_Click(object sender, EventArgs e)
        {
            try
            {
                if (TaskDialogResult.Ok == TaskMessageBox.Show("You are about to launch the Device Manager. Improper usage of system tools may render your server unusable.",
                                                               "Caution",
                                                               "Be careful when using the Device Manager",
                                                               TaskDialogButtons.OkCancel,
                                                               TaskDialogIcon.Warning))
                {
                    System.Diagnostics.Process.Start("devmgmt.msc");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void btnRunSetupExe_Click(object sender, EventArgs e)
        {
            try
            {
                if (TaskDialogResult.Ok == TaskMessageBox.Show("Please be careful which .exe or .msi files you run. Malicious files may harm your server.",
                                                               "Caution",
                                                               "Only run files from sources you trust",
                                                               TaskDialogButtons.OkCancel,
                                                               TaskDialogIcon.Warning))
                {

                    if (DialogResult.OK == ofdSetupExe.ShowDialog())
                    {
                        System.Diagnostics.Process.Start(ofdSetupExe.FileName);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
